<template>
  <div class="User">
    <el-menu
        mode="horizontal"
        background-color="#545c64"
        text-color="#fff">
      <el-menu-item @click="gouser()">返回 </el-menu-item>
      <el-menu-item @click="unlogin()"style="position: fixed;right: 19px;top: 8px">注销</el-menu-item>
    </el-menu>
    <br><br>
    <el-table :data="clas" stripe border style="width: 100%">
      <el-table-column prop="classname" label="课程名"></el-table-column>
      <el-table-column prop="classteacher" label="授课老师"></el-table-column>
      <el-table-column prop="classaddress" label="成绩"></el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  created() {
    axios.get('').then(res=>{
      console.log(res);
      this.data=res.data
    })
  },
  data(){
    return{
      data:[],
    }
  },
  methods:{
    gouser() {
      this.$router.push('/user/');
    },
    unlogin(){
      axios.post('/user/logout').then(res=> {
        if(res.data.code===10000){
          this.$message.success(res.data.msg);
          this.$router.push('/login');
        }else{
          this.$message.error(res.data.msg);
        }
      })
    }

  }
}
</script>

<style scoped>

</style>